package cn.broadsense.thrid.param;

import cn.broadsense.common.exception.ServiceException;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 人像布控设置
 *
 * @author pengxin
 * @date 2022-10-12 16:55
 */
@NoArgsConstructor
@Data
public class FaceSurveillanceAddParam extends BaseParam {
    private static final long serialVersionUID = 2657403547417007153L;

    /**
     * 人像库id
     */
    private String repositoryId;
    /**
     * 通道编码
     */
    private String channelCode;
    /**
     * 相识度
     */
    private BigDecimal threshold;
    /**
     * 布控等级 选填
     */
    private Integer level;


    @Override
    public void checkParam() {
        if (StrUtil.isBlank(repositoryId)) {
            throw new ServiceException("人像库id不能为空");
        }
        if (StrUtil.isBlank(channelCode)) {
            throw new ServiceException("通道编码不能为空");
        }
        if (threshold == null) {
            throw new ServiceException("布控阈值，取值范围为[0-1]");
        }

    }

    @Override
    public Class getResultClass() {
        return JSONObject.class;
    }
}
